package WinterFlower.work0715.exampleclass;

/**
 * @author ZJM
 * @version 1.0
 * @since 2022-07-15 18:57:45
 */
public class StringEX02 {
    public static void main(String[] args) {
        String s ="andwe6CW585CS29DccdvZ5564";
        String part ="0";
        int sum =0;
        for (int i = 0; i <s.length(); i++) {
            if(Character.isDigit(s.charAt(i))){
                part+=s.charAt(i);
            }else{
                sum += Integer.parseInt(part);
                part = "0";
            }
        }
//    如果字符串的最后是连续数字，for里面没有机会执行转数字并累计的
        sum += Integer.parseInt(part);
        System.out.println(sum);
    }
}
